package actions;

import java.util.List;

import org.hibernate.Session;

import com.core.utility.HibernateUtils;
import com.opensymphony.xwork2.ActionSupport;

public class HelloWord extends ActionSupport {
    String greetings = null;

    public String execute() throws Exception {
	setGreetings("Hello World");
	return SUCCESS;
    }

    /**
     * @return the greetings
     */
    public String getGreetings() {
	return greetings;
    }

    /**
     * @param greetings
     *            the greetings to set
     */
    public void setGreetings(String greetings) {
	this.greetings = greetings;
    }

    private static final long serialVersionUID = -2613425890762568273L;

    public String welcome()

    {

	return "welcome";

    }

    public String friends()

    {

	return "friends";

    }

    public String office()

    {

	return "office";

    }
    public String template()

    {

	return "template";

    }
    
    public String searchResult()
    {
	
	Session session = HibernateUtils.getSessionFactory().getCurrentSession();
	session.beginTransaction();

	 List result = session.createQuery("from Country").list();
	 System.out.println("Size of country "+result.size());
	 session.getTransaction().commit();
	// session.close();


    	return "searchResult";
    }
    public String template01()

    {

	return "template01";

    }
    public String template02()

    {

	return "template02";

    }

    public String template03()

    {

	return "template03";

    }

    public String template04()

    {

	return "template04";

    }

    public String template05()

    {

	return "template05";

    }


}